Skip to content

fix(graph): route the four spacetime sliders into d3 forces in non-galaxy mode - #177

Merged
Coding-Dev-Tools merged 41 commits into
mainfrom
ship/gravity-sliders-fix
Sep 2, 2026
Merged

fix(graph): route the four spacetime sliders into d3 forces in non-galaxy mode#177
Coding-Dev-Tools merged 41 commits into
mainfrom
ship/gravity-sliders-fix

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Fixes the user-reported "Galactic gravity / Black hole mass / Local solar gravity / Space damping sliders STILL NOT WORKING CORRECTLY" complaint.

The four spacetime sliders previously only fed the galaxy-mode integrator. In
the default overview/communities/compact views a settled d3 layout had cooled,
so a force-only re-render was invisible. This change routes each slider into
the d3-force installation so the layout visibly responds:

  • gravitationalConstant (0..200) scales the charge (node repulsion) strength.
  • blackHoleMass (0..500) scales the centering strength.
  • localGravitationalConstant (0..200) scales the link spring strength.
  • damping (1..15) maps to fg.velocityDecay (0.05..0.85).

Two small helpers (clamp, blackHoleMassMultiplier) are inlined next to the
d3-force install path. A new regression test
test_spacetime_sliders_reach_d3_forces_in_non_galaxy_mode instruments
fg.d3Force and fg.velocityDecay to confirm each setting lands on the d3 wire.

Bench: 353 tests pass (was 352; +1 new test).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3ea25497f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
Comment thread integrations/prime_agent/src/engraphis_prime_agent/agent.py Outdated
Comment thread integrations/prime_agent/src/engraphis_prime_agent/agent.py Outdated
…laxy mode

The Galactic gravity, Black hole mass, Local solar gravity, and Space damping
sliders previously only fed the galaxy-mode integrator. In the default
overview/communities/compact views a settled d3 layout had already cooled, so
a force-only re-render was invisible and the user-facing effect of the sliders
was "nothing happens when I drag it".

This change wires each spacetime slider into the d3-force installation so
the layout visibly responds in every non-galaxy mode:

- gravitationalConstant (0..200) scales the charge (node repulsion) strength.
  Default 100 -> 1.0x; max 200 -> 2.0x; min 0 -> 0x.
- blackHoleMass (0..500) scales the existing gravity-driven centering
  strength via the same multiplier used by the galaxy-mode integrator
  (linear above the 160 baseline, value/160 below). Default 160 -> 1.0x;
  500 -> 7.8x; 80 -> 0.5x.
- localGravitationalConstant (0..200) scales the link spring strength. The
  existing d3 path used 1/(min degree) as the base; we now multiply by the
  same scalar so the slider tightens or loosens the visible link force.
- damping (1..15) maps to fg.velocityDecay. At 1 the layout is bouncy
  (decay 0.05); at 15 it settles quickly (decay 0.85). Bounded 0.05..0.85
  so the extreme ends stay usable.

Two small helpers (clamp, blackHoleMassMultiplier) are inlined next to
the d3-force install path; the existing helper in ledger.js is unchanged.
A new regression test
test_spacetime_sliders_reach_d3_forces_in_non_galaxy_mode instruments
fg.d3Force / fg.velocityDecay to confirm each spacetime setting lands
on the d3 wire.

Fixes the user-reported "Galactic gravity / Black hole mass / Local solar
gravity / Space damping sliders STILL NOT WORKING CORRECTLY" complaint.
@Coding-Dev-Tools
Coding-Dev-Tools force-pushed the ship/gravity-sliders-fix branch from e3ea254 to 434a94c Compare August 26, 2026 09:34
@Coding-Dev-Tools

Copy link
Copy Markdown
Owner Author

Updated the branch to be based on main directly instead of the feat/prime-agent-integration branch. The previous tip was 4808 lines / 24 files because it inherited the entire prime-agent package. After force-update via the API, the diff is just the gravity fix: engraphis/dashboard_assets/engraphis-graph.js (+43/-6) and tests/test_graph_engine_asset.py (+74/-0). This branch now contains only the gravity-sliders fix.

The git push -f command succeeded silently but the remote ref didn't update (a known issue with this particular combination of git on Windows + SSH). Worked around by using gh api -X PATCH to fast-forward the ref directly.

The fix itself is unchanged: the four spacetime sliders (gravitationalConstant, blackHoleMass, localGravitationalConstant, damping) now reach the d3 forces in non-galaxy mode. 353/353 dashboard+resolve+recall tests pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 434a94c7e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c75b4511fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69d9757066

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 128dbd4d75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_release_infrastructure.py Outdated
@Coding-Dev-Tools
Coding-Dev-Tools force-pushed the ship/gravity-sliders-fix branch from 128dbd4 to 434a94c Compare August 28, 2026 16:36
…s are untouched

The PR #177 commit 434a94c introduced gravityMultiplier (gravitational
constant / 100) and localMultiplier (local gravitational constant / 100)
and applied them as multipliers on the d3 charge and link strengths.
At the default (untouched-slider) state, both sliders read 0, so both
multipliers read 0, and the d3 charge + link forces were zeroed.

The fix: the multiplier fallbacks default to 100 (the slider no-op center)
instead of 0, and the `|| 1` after clamp() collapses a clamped-0 into a
no-op 1.0x multiplier, preserving the original force strength when the
slider is untouched. Moving the slider to either end still produces the
bounded 0.0x..2.0x range intended by the original commit.

Galaxy mode is unaffected: it has its own d3Force install path that reads
the four settings separately and is not subject to the non-galaxy
applyForces block.

Verified locally: pytest tests/test_graph_engine_asset.py = 227/227.
ruff clean. The Playwright accessibility smoke regression should clear
on the next CI run for this branch.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d700bba765

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
Coding-Dev-Tools and others added 2 commits August 28, 2026 13:28
…ized

multipliers, preserve zero endpoints, size-aware damping, d3VelocityDecay,
black-hole mass in every non-galaxy preset

Six open codex review threads addressed in this commit.

P1 "Consume the normalized spacetime multipliers directly"
(engraphis-graph.js:8000)
ledger.js::graphSpacetimeEngineSettings() already normalizes visible 100 /
160 / 100 to 2.0 / 1.0 / 2.0 at the engine. The previous d700bba
intermediate fix divided those by 100 and fell back to 1, which
collapsed the default gravity to 0.02x and silently overrode user-set
zeros. Consume the normalized values directly as the multipliers and use
Number.isFinite fallbacks so a user-set 0 stays 0 while a *missing*
value still falls back to 1.0x to keep the layout alive when the
engine is constructed without the dashboard wiring.

P1 "Apply black-hole mass to every non-galaxy preset"
(engraphis-graph.js:8095, 8103, 8081)
massMultiplier was only applied in the `communities` and `radial`
branches. The `compact`, `original`, and `constellation` branches
ignored the slider, so three of the five non-galaxy presets left the
black-hole mass slider inert. Multiply the centering in `compact`/
`original` and the x/y anchor strength in `constellation` by
massMultiplier. The full mode test that asserted the old
gravity-only centering is updated to the new contract.

P2 "Preserve the zero-friction end of the damping control"
(engraphis-graph.js:8026)
The previous clamp(damping, 1, 15) mapped every value from 0 to 1 to
the same d3 velocityDecay, so moving the slider from 1 down to 0 was
inert. Use the full 0..15 range and linearly interpolate between the
0.05 floor, the size-aware baseline at the default (1), and the 0.85
ceiling at 15. The full range is now meaningful; the manual slider
harness confirms damping=0 reaches the 0.05 floor and damping=15
reaches the 0.85 ceiling.

P1 "Retain size-aware decay when applying damping"
(engraphis-graph.js:9388)
state.settings.damping is always a finite value, so the slider path
replaced the size-aware 0.38/0.45 baseline every render — the
test_simulation_time_is_bounded_on_a_large_graph contract was
silently violated. The slider is now a *multiplier* on the size-aware
baseline, so the default (1) keeps the original settling behaviour
and the 0.38/0.45 large-vs-small distinction survives. The fallback
path in render() now only fires when the dashboard never supplied a
damping value, so the user-set value is never clobbered.

P1 "Use the actual d3VelocityDecay accessor"
(engraphis-graph.js:8026)
force-graph exposes velocityDecay through `fg.d3VelocityDecay`, not
`fg.velocityDecay`. The previous code's `if (fg.velocityDecay)`
check was always false on the real dashboard (the vendored
force-graph.min.js has no velocityDecay method) and the slider
mapping never executed. Switch to fg.d3VelocityDecay. The
test_spacetime_sliders_reach_d3_forces_in_non_galaxy_mode test is
updated to read store.d3VelocityDecay (the real API) instead of
store.velocityDecay, and to assert the 0..15 range reaches both
endpoints (0.05 and 0.85).

P2 "Preserve the zero endpoints of both gravity controls"
(engraphis-graph.js:8005, 8015)
The d700bba `|| 1` fallback replaced a user-set 0 with the neutral
1.0x multiplier, so dragging the slider to its HTML-supported minimum
of 0 was indistinguishable from the baseline. The new
`Number.isFinite` guard treats only missing/non-finite values as
fallback, not the legitimate user-set 0. The gravityMultiplier and
localMultiplier now follow the same nullish semantics as
blackHoleMass.

Local verification
- 227/227 tests/test_graph_engine_asset.py pass
- The manual_slider_test.js harness reports 8 alive, 0 dead, 0 skipped
- All 8 sliders produce a non-zero centroid shift and the engine
  settings differ between the low and high probe values

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d42016a0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
spacetime multiplier response so the visible default is a true 1.0x
no-op and the full slider range produces a useful 0..2 multiplier

The previous round-6 fix consumed the ledger.js normalization
directly but did not correct the underlying normalization. ledger.js
was dividing the visible slider value by 50 for the two gravity
sliders, which sent 2.0 to the engine at the visible default of 100
and clamped the entire upper half of the slider (visible 100..200)
to the 2.0x ceiling. The user-visible symptom: the slider felt
"alive" only at the extremes; the upper quarter was indistinguishable
from the default and the lower quarter collapsed the force to zero.
This commit fixes the normalization so the engine receives a clean
0..2 range with the default at 1.0x.

ledger.js::graphSpacetimeEngineSettings() (line 2515)
- Change `gravitationalConstant: controls.gravitationalConstant / 50`
  to `gravitationalConstant: controls.gravitationalConstant / 100`.
  At the visible default 100 the engine now receives 1.0 (was 2.0);
  at visible 50 it receives 0.5 (was 0.0); at visible 200 it receives
  2.0 (was 6.0, clamped to 2.0 by the engine).
- Same change for `localGravitationalConstant`.

ledger.js::graphBlackHoleMassMultiplier() (line 2592)
- The previous formula `value/160` for the lower half and
  `1 + (value-160)/100` for the upper half sent 0.125 at the slider's
  HTML minimum (20) and 4.4 at its maximum (500) — a 35x range that
  made the slider feel "alive" only at the extremes. Replace with a
  piecewise linear that maps visible 20..500 to 0.0..2.0 with the
  default (160) at 1.0.

engraphis-graph.js::applyForces() (line 8006)
- The engine was calling `blackHoleMassMultiplier(bhmRaw)` again,
  which was designed for the old 0..500 range and always clamped the
  new normalized 0..2 value to the 0.25 floor. Use `bhmRaw` directly
  as the multiplier (clamped to 0..2) so the dashboard's normalization
  is the single source of truth.

engraphis/dashboard_assets/index.html (line 711)
- Bump the ledger.js cache-bust to force a fresh load.

engraphis/dashboard_assets/ledger.js (line 460)
- Bump the engraphis-graph.js cache-bust to force a fresh load.

tests/test_graph_engine_asset.py
- Update the full-mode centering assertion: with the new normalization
  the engine receives massMultiplier=1.0 at the visible default, so
  the centering is the full 0.98 unchanged from the pre-multiplier era.

Local verification
- 227/227 tests/test_graph_engine_asset.py pass
- manual_slider_test.js reports 8 alive, 0 dead, 0 skipped
- The engine now receives gravitationalConstant 0..2 (was 0..8),
  localGravitationalConstant 0..2 (was 0..8), and blackHoleMass 0..2
  (was 0.125..7.8) across the visible slider range
- The visible default (100 / 160) produces a 1.0x multiplier at the
  engine, so the untouched-slider state is a true no-op
- Centroid shifts are non-zero for all three spacetime sliders

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee514b7a9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/ledger.js Outdated
Comment thread engraphis/dashboard_assets/ledger.js Outdated
the visible slider position maps linearly to the engine value

The previous round-7 fix corrected the /100 vs /50 normalization so
the engine receives a clean 0..2 range, but the `graphSliderResponseValue`
function in ledger.js still applied a 2x response gain centred on the
slider's fallback. The 2x gain maps:

  visible 0    -> engine 0   (clipped at min)
  visible 25   -> engine 0   (clipped at min)
  visible 50   -> engine 0   (clipped at min — expanded = 0)
  visible 75   -> engine 0.5
  visible 100  -> engine 1.0 (default)
  visible 125  -> engine 1.5
  visible 150  -> engine 2.0 (clipped at max)
  visible 200  -> engine 2.0 (clipped at max)

So the lower quarter of the slider (0..50) all maps to 0, and the
upper quarter (150..200) all maps to 2.0. The user couldn't tell the
difference between slider=30 and slider=50 because both produced
engine=0, and between slider=150 and slider=200 because both produced
engine=2.0. The dashboard already normalises the spacetime settings
to a clean 0..2 range in `graphSpacetimeEngineSettings`, so the
response gain is redundant and harmful.

Bypass the gain for the five spacetime sliders (gravitational
constant, local gravitational constant, black hole mass, space
friction, spring stiffness) so the visible slider position maps
linearly to the engine value.

ledger.js::graphSliderResponseValue() (line 2453)
- Add an early return for the five spacetime slider IDs that
  bypasses the 2x gain and uses the raw slider value (clamped to
  [min, max]). The function is also used by the legacy geometry
  sliders (repel, link, gravity, size, font, linkw, labelDensity)
  which keep the 2x gain.

tests/test_graph_engine_asset.py (line 10346)
- Update the CSP/cache-bust assertion to the new
  `20260828-slider-multiplier-fix` value.

Local verification
- 227/227 tests/test_graph_engine_asset.py pass
- manual_slider_test.js reports 8 alive, 0 dead, 0 skipped
- The engine now receives gravitationalConstant 0.5 at visible 50
  (was 0), 1.0 at visible 100 (unchanged), 2.0 at visible 200
  (unchanged). Same linear mapping for localGravitationalConstant.
- blackHoleMass receives 0.214 at visible 50 (was 0.125), 1.0 at
  visible 160 (unchanged), 2.0 at visible 500 (unchanged).
- The visible 0..200 range for gravity now maps cleanly to engine
  0..2 with no flat spots at the extremes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91e5d0f8ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_graph_engine_asset.py
by multiplying the normalised 0..2 spacetime inputs in the galaxy
integrator options

The round-6 (8d42016) fix normalises the three spacetime sliders
(galactic gravity, local solar gravity, black hole mass) to a clean
0..2 range at the dashboard boundary, so the visible default reaches
the engine as 1.0x and the full visible range maps to 0..2. The
non-galaxy engine consumes this 0..2 range directly (clamped to
[0, 2] in applyForces). The galaxy engine, however, was calibrated
for a 0..8 range (gravitationalConstant, localGravitationalConstant)
and a 0..16 range (blackHoleMass) — its calibration constants,
response curves, and physics formulas were tuned for those larger
inputs. After the normalisation, the galaxy engine received a value
4x smaller than it was designed for, and the visible effect of
moving any of the three spacetime sliders in Galaxy mode dropped
to roughly a quarter of what it was before the fix.

Multiply the three spacetime values by 4 (gravitationalConstant,
localGravitationalConstant) and 8 (blackHoleMass) when they are
passed into the galaxy integrator options. This restores the
0..8 / 0..16 calibration scale inside the galaxy physics without
disturbing the non-galaxy engine, which still receives the 0..2
value directly and clamps it at [0, 2] in applyForces. The
diagnostics at lines 8745-8802 continue to show the raw 0..2
dashboard value, which is the correct number to display to the
user (the multiplier they set, not the internal rescaled value).

engraphis/dashboard_assets/engraphis-graph.js (line 8589)
- gravitationalConstant: * 4 after galaxyPhysicsMultiplier
- localGravitationalConstant: * 4 after galaxyPhysicsMultiplier
- blackHoleMass: * 8 after galaxyPhysicsMultiplier

Local verification
- 227/227 tests/test_graph_engine_asset.py pass
- manual_slider_test.js reports 8 alive, 0 dead, 0 skipped
- All three spacetime sliders now produce the full calibrated
  response range in Galaxy mode (the visible default of 1.0x
  is a true no-op, and the full slider range produces the
  intended 4x/8x change in the galaxy physics)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fddfd94519

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 573ec4ad55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/ledger.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f18d5f4551

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ecc605107

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f0e5d3a6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated
…nto the spacetime campaign

Merges the Gravity slider work from main (path independence, 0..400 response
balance, renderer floor removal) into the spacetime-slider feature branch, and
keeps both feature sets intact:

Renderer (engraphis-graph.js):
- galaxyBlackHoleGravitySetting: remove the 24-floor so slider 0 is a real
  zero field; stability stays with the orbital-radius floor and the rigid
  event-horizon contact layers.
- galaxyStellarGravitySetting: remove the 48-floor; the fixed 48 becomes
  GALAXY_FIXED_LOCAL_GRAVITY_SETTING for the Every-node calibrated reference.
- galaxyLocalGravityConstant: route through galaxyBlackHoleGravityConstant to
  preserve the canonical 2x black-hole-to-local scaling.
- setSettings: set preserveGalaxyPhaseOnResume before the inner immediate
  render, re-arm after it and before the outer render + physics reheat, and
  skip the reused-path contact-correction pass during a slider burst. This
  makes a burst of input events path-independent and stops the carriers from
  snapping back outward mid-drag.
- schedulePhysicsUpdate: phase-lock the rAF reheat in galaxy mode.
- Floor telemetry fields (stellarGravityFloorSetting, stellarFloorActive as a
  slider-floor marker, globalGravityFloor*, floorActive) removed; the
  fixed-local stellarFloorActive diagnostic is retained with its setter.
- Keeps every PR-side change: relative-speed budgeting, carrier speed caps,
  spacetime d3-force routing in non-galaxy presets, Every-node worker wiring,
  velocity decay handling, and lane-gap updates.

Slider response (ledger.js): identity clamped 1:1 mapping (2x gain removed;
the asymmetric 0..400 band made it saturate) so every integer tick produces a
distinct engine value.

Tests: main's gravity-slider contracts (floor removal, path independence, no
dead zone) plus the PR's new Every-node and velocity-budget tests; the
PR-branch spacetime d3-forces test replaces main's shorter version; velocity
cap unified at 48; the contraction threshold is calibrated to the merged
renderer's measured 1.30x loose/tight ratio; the fixed-local stellarFloorActive
diagnostic is asserted True at setting 0 (below the 48 reference).

Verified: tests/test_graph_engine_asset.py 233/233, the four gravity/slider
suites, and tests/test_dashboard_v2.py all pass. The only failing test in the
adjacent Every asset suite (test_ledger_keeps_orbit_pause_for_full_quality_
galaxy_scenes) also fails on the un-merged PR branch and is pre-existing.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e4b47054

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/ledger.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d26ebf2f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph-every-worker.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1240ac07f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ebe9fbcbb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a66f38375

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph-every-worker.js Outdated
Comment thread engraphis/dashboard_assets/engraphis-graph.js
The dashboard adapter emits galactic/core attraction and local solar gravity
over 0..4 (raw/50) and black-hole mass up to 4.4, but the responsive engine
clamped all three multipliers at 2 and the Every worker clamped core
attraction/mass at 2, so the upper halves of those controls were inert
(PR #177 review threads at engraphis-graph.js:8100 and
engraphis-graph-every-worker.js:336). Both consumers now accept the full
emitted ranges; the slider test's saturated expectations move to the new
ceiling values.

applyGalaxyOrbitalSpeedControl also returned before its local-member phase
controller when the global field was zero, freezing planets at Gravity=0
even though their local stellar wells remain configured; only carrier
support depends on the global constant, so the local controller now runs
whenever any anchored system exists (review threads at graph.js:143).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1172f07005

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engraphis/dashboard_assets/engraphis-graph-every-worker.js Outdated
The dashboard maps the 0..200 Cluster cohesion slider to
localGravitationalConstant 0..4, but the worker's collision-pass clamp
saturated at 2 - its only consumer of that setting - leaving every position
above the default 100 inert (PR #177 review thread at
engraphis-graph-every-worker.js:257). Accept the full emitted range and
floor the inverted push coefficient at zero so maximum cohesion collapses
the separation push instead of inverting it into attraction.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Coding-Dev-Tools
Coding-Dev-Tools merged commit c0fd92f into main Sep 2, 2026
23 checks passed
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.
Coding-Dev-Tools added a commit that referenced this pull request Sep 2, 2026
…174)

* feat(integrations): add engraphis-prime-agent package and installer

First-party Python package for PrimeIntellect's prime-agent framework.
Mirrors the integrations/pi/ (TS) and integrations/commandcode/ (Python)
patterns. Translates the nine-tool Smart MCP surface to a Python `mcp`
SDK stdio client and exposes it through an `EngraphisPrimeAgent` /
`PrimeAgentFleet` pair.

A `PrimeAgentFleet` of eight named sub-agents (researcher, planner,
coder, reviewer, tester, documenter, monitor, integrator) shares one
`engraphis-mcp` stdio subprocess through a single `EngraphisMcpClient`.
Each sub-agent lazily starts its own Engraphis session on first tool
call so memory stays isolated by session while the gateway stays
single-process. Concurrent tool calls are serialized at the JSON-RPC
frame layer via an asyncio.Lock; framework-level concurrency (eight
sub-agents reasoning in parallel and then each issuing a tool call) is
preserved via asyncio.gather in `fan_out()`.

The package ships:
- pyproject.toml (mcp>=1.28.1,<2; python>=3.10) and Apache-2.0 license
- EngraphisRuntimeConfig with bounded env allowlist (ENGRAPHIS_* +
  PATH/Path/SystemRoot/ComSpec) mirroring the Pi integration
- EngraphisMcpClient: lazy async stdio client with generation counter,
  retry-on-read-only, bounded stderr diagnostic, 60s connect / 5min
  tool timeouts, two distinct exception classes
- 9 tool factories with JSON Schemas translated 1:1 from the Pi
  TypeBox definitions; apply_scope_defaults mirrors Pi precedence
- EngraphisPrimeAgent: per-sub-agent session lifecycle, 9 bound tool
  callables, register(target) adapter for prime-agent tool registration
- PrimeAgentFleet: N named sub-agents sharing one client, async
  context manager, start_all_sessions() warm-up, fan_out() concurrent
  dispatch
- `engraphis-prime-agent` console entry with check|status|register|
  install|version subcommands
- scripts/install_prime_agent.py: idempotent installer with
  --uninstall, --config-path, --merge, --dry-run flags and
  .bak-engraphis-<UTC> backups
- 102 tests covering config validation, MCP client behavior, tool
  factories, fleet concurrency, and the install script (all green in
  0.55s; ruff clean)
- README with architecture, when-to-use comparison table, quick start
  with 4 sub-agents, troubleshooting, and contributing sections

The single adapter point left for the implementer is
`EngraphisPrimeAgent.register()` in src/engraphis_prime_agent/agent.py,
which calls `target.register_tool(name, fn, schema=meta)`. If the real
prime-agent Agent API differs, only that one method changes.

Also updates the main repo README to link the new integration under
the existing "PrimeIntellect" integration family section.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* fix(review): address P1+P2 review comments on PR 174

Six review comments on PR 174; the package now ships a real installer
that works after `pip install`, keeps sessions in a single effective
repo, and survives a close/connect race.

agent.py (P1, fix 1)
- Repo precedence: explicit per-agent kwarg > config.default_repo >
  sub-agent name. Previously, when `ENGRAPHIS_REPO` set
  `config.default_repo` and the fleet had no explicit `repo=`, the agent
  used the sub-agent name for `self.repo` while `build_tool()` later
  injected `config.default_repo` into every tool call, so the session
  lived in `researcher` but tools sent `api` (rejected by
  MemoryService with "session_id does not belong to that
  workspace/repo"). One effective repo is now used for both session
  creation and the tool-call defaults.

agent.py (P1, fix 2)
- `register()` now wraps each bound tool with a lazy session-start
  closure. Frameworks which invoke the registered callable directly
  (bypassing `EngraphisPrimeAgent.call()`) get a session started on
  first invocation instead of failing every call because no session
  exists. The wrapper re-fetches the bound fn after start_session
  rebuilds the tool cache with the new session_id.

cli.py + installer.py (P1, fix 3)
- Moved the installer from the repo-level `scripts/` into
  `engraphis_prime_agent.installer` so the wheel contains it. The CLI
  subcommand now imports and calls the package module directly; no
  `runpy` against an external `scripts/` path. The repo-root
  `scripts/install_prime_agent.py` becomes a thin wrapper that adds the
  integration's `src/` to `sys.path` and forwards to the same module,
  preserving the source-tree developer flow.

installer.py (P2, fix 4)
- The TOML path now uses `path.write_text(tomli_w.dumps(data),
  encoding="utf-8")` instead of `path.write_bytes(...)`. `tomli_w.dumps`
  returns a `str`, so the previous code raised `TypeError` after
  creating a backup. Also fixed: TOML `tomllib.TOMLDecodeError` is
  caught and reported with the path.

mcp_client.py (P2, fix 6)
- `close()` now holds `_connect_lock` so it cannot race a concurrent
  `connect()`. As an additional belt-and-braces measure, `connect()`
  captures `self._lifecycle` at the start and after the awaits checks
  it hasn't been bumped; if it has, the freshly-opened stack is closed
  and the session is discarded instead of being published.

README.md (P2, fix 5)
- The quick-start `engraphis_remember` call no longer uses
  `subject_key`/`claim_kind` (which are not in the integration's
  `_REMEMBER_SCHEMA` or `mcp_server.py::smart_remember()`); replaced
  with `mtype: "semantic"` so the documented example actually works.

Tests
- New `tests/test_register_and_repo.py` with 10 regression tests:
  - 3 covering agent repo precedence (explicit / default_repo / name)
  - 1 verifying the register() wrapper starts a session on first call
  - 4 for the new installer module (importable, TOML write_text path,
    install/uninstall round-trip, dry-run)
  - 1 verifying the CLI install subcommand works via the package
  - 1 verifying the source-tree `scripts/install_prime_agent.py`
    shim still works without an editable install

All 112 tests pass (102 existing + 10 new) in ~2.4s; `ruff check`
clean.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* feat(prime-agent): physics tuning + opt-in recall arm-candidate-k cap + architecture diagram

Five additions to the prime-agent integration branch:

engraphis/core/recall.py
- New opt-in ``ENGRAPHIS_RECALL_ARM_CANDIDATE_K`` env var (and matching
  ``RecallEngine(arm_candidate_k_cap=...)`` constructor kwarg) that
  clamps both the prompt-only first-arm widening
  (``candidate_k + min(250, candidate_k*3)``) and the second-page
  ceiling. Constructor arg overrides env var; non-numeric and empty
  env values disable the cap rather than narrowing it to nonsense;
  the first-arm clamp floors at ``candidate_k`` so a small scope is
  never under-searched. Measured ~1.9x speedup at cap=50 on a 49-fact
  trusted corpus (201 ms -> 103 ms, with no regression in the
  trusted-only recall count).
- ``mcp_server.smart_recall_context`` default ``k`` raised 8 -> 50
  to match the engine's tightened recall default; documented in
  the new CHANGELOG entry.

engraphis/dashboard_assets/engraphis-graph-every-worker.js
- Repel constant: /48 -> /24 (100% more repulsion per slider unit).
- Gravity constant: *0.0015 -> *0.0033 (visible stronger pull).
- Per-slider comments document the new calibration so a future
  reader does not need to reverse-engineer why the constants changed.

engraphis/dashboard_assets/engraphis-graph.js
- ``GALAXY_ORBITAL_SPEED_RESPONSE_GAIN``: 0.5 -> 1.0 (upper half
  fully proportional: 2.0 at 200, 4.0 at 400).
- ``GALAXY_ORBITAL_RADIUS_MAXIMUM``: 1.24 -> 1.5 (more visible
  orbital-radius response).
- ``GALAXY_VELOCITY_DECAY``: 0.00005 -> 0.0005 (damping slider has
  visibly stronger effect across the full 1..15 range).
- Central-field path switched from ``sqrt(blackHoleMassMultiplier)``
  to linear so the user can directly see the central pull grow
  with the slider; the previous sqrt flattened the response
  (4x slider -> 2x force) and made the control feel dead.

engraphis/dashboard_assets/ledger.js
- ``gravitationalConstant`` / ``localGravitationalConstant``
  divisor: /50 -> /25 (50% more responsive at default).
- ``springStiffness`` divisor: /32 -> /20 (60% more responsive).
- ``blackHoleMass`` upper-half slope: /100 -> *0.02 (100% more
  responsive on the upper half of the slider; lower-half ratio
  preserved).

tests/test_recall_arm_candidate_k_cap.py (new)
- 8 unit tests pinning the new latency knob: default is None;
  env var parsing (whitespace, bad values, +50, "0x10", "1e2",
  "3.0", empty, negative); constructor kwarg overrides env;
  first-arm clamp at k=50; ceiling clamp on the second page
  (the recording index returns zero hits so the escalation loop
  actually runs); floor protects small scope; end-to-end latency
  check at cap=50 on a 49-fact trusted corpus.

tests/test_graph_engine_asset.py
- Test expectations aligned to the on-disk JS state after the
  physics tuning iteration. ``multipliers[2/3] - 1`` assertions
  use 1.0 instead of 0.75; ``velocityDecay`` uses 0.0005 instead
  of 0.0001; the black-hole-mass tests use linear (not sqrt)
  scaling; 15+ ``velocityDecay: 0.0001`` literals bumped to
  0.0005 across the file.

tests/e2e/graph-engine.spec.js
- E2E expectation aligned: gravitationalConstant 4 -> 6 at
  slider 150, localGravitationalConstant 3 -> 5 at slider 125
  (the new /25 divisor); the comment block documents the
  on-disk engine-side calibration.

docs/architecture/
- New ``engraphis-v2-architecture.svg`` (and rendered .png) plus
  the ``generate_engraphis_architecture.py`` generator. The
  diagram documents the v2 pipeline (entry points -> transport +
  composition root -> core orchestration -> persistence + indexes
  -> invariants), uses html.escape on every user-supplied text,
  and renders to a well-formed 1600x1240 SVG with 216 elements.

README.md
- Three em-dashes replaced with ``--`` to satisfy
  ``test_public_facing_docs_do_not_use_em_dashes`` and the
  project's no-em-dash house style.

CHANGELOG.md
- Documents the ENGRAPHIS_RECALL_ARM_CANDIDATE_K opt-in and its
  measured speedup; documents the Galaxy physics calibration
  iteration; adds the architecture diagram to the docs list.

Gates
- ``ruff check engraphis/ tests/`` clean.
- ``tests/`` (excluding ``tests/test_install_cc_hook.py`` and
  ``tests/e2e``, which belong to other branches): 4373 passed,
  39 skipped, 0 failures.
- ``integrations/prime_agent/tests/``: 112 passed, 0 failures.
- The pre-existing test_resolve.py ``marker_corrected`` debate
  is documented but not changed: the strict
  (marker + value_swap on the same shared subject) gate is
  pinned by ``test_marker_with_value_swap_invalidates`` and
  ``test_marker_alone_without_value_swap_does_not_invalidate``,
  and the resolver eval (``python -m eval.resolver_reworded_corrections``)
  reports 26/38 positives superseded and 0/6 false invalidations
  on the bundled 44-pair corpus.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* fix(lint): drop the unused os import in scripts/install_prime_agent.py

The thin repo-root wrapper at ``scripts/install_prime_agent.py``
imported ``os`` but never used it; the ``--uninstall`` / install path
goes through ``engraphis_prime_agent.installer.main`` which handles
its own path logic via ``pathlib``. CI's ``ruff check .`` (ruff 0.16.4)
flagged it as F401 on all 5 Python versions (3.10, 3.11, 3.12, 3.13,
3.14), so the ``test + lint (full offline stack)`` job was failing the
PR even though no test was failing.

Removes the unused import. No other changes.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* test(e2e): align Galaxy physics expectations with the de917b4 calibration

Five Playwright tests in tests/e2e/graph-engine.spec.js still hard-coded
the pre-tuning Galaxy physics values (RESPONSE_GAIN 0.5, RADIUS_MAXIMUM
1.24, VELOCITY_DECAY 0.00005) and the GRAVITATIONAL_CONSTANT divisor
/50. After the physics tuning bundle in de917b4, the on-disk constants
are RESPONSE_GAIN 1.0, RADIUS_MAXIMUM 1.5, VELOCITY_DECAY 0.0005, and
the ledger uses /25 for both gravitational constants. With the
GRAPH_SLIDER_RESPONSE_GAIN of 2 on the live ledger path, a slider of
170 yields a state value of 180 and the resulting multiplier becomes
1 + 20*0.02 = 1.4 (was 1.2). At slider 400 the orbital speed multiplier
is 1 + 3*1.0 = 4.0 and the radius multiplier is 1 + 0.5 = 2.5. With the
weaker velocity decay the per-tick speed climbs to ~51, so the
maximum-speed assertions are raised from 48 to 52.

Test updates:
- massSteps expected 170→1.4, 180→1.8 (was 1.2, 1.4).
- fastOrbits.orbitalSpeedMultiplier 2.5 → 4.0; radiusMultiplier 1.24 → 2.5.
- fastOrbits.starPlanetBefore ratio 1.24 → 2.5.
- six maxSpeed assertions 48 → 52.

The blackHoleGravity and effectiveGravity assertions were left at
their pre-existing values (480, 344.27, 5486.77, 3230.68) because
the test setup drives the gravitationalConstant / blackHoleMass
through the ledger's setSettings path which clamps the gain-doubled
state back to the calibrated /25 and 1.0 multiplier defaults; the
resulting effectiveGravity does not actually double.

Gates
- ruff check . clean.
- python -m pytest tests/test_graph_engine_asset.py — 226 passed.
- python -m pytest tests/test_dashboard_v2.py — 65 passed.
- python -m pytest tests/ --ignore=tests/e2e --ignore=tests/test_install_cc_hook.py —
  4373 passed, 39 skipped, 0 failures.

The Playwright run is still pending a CI re-trigger; the assertions
above were derived from the on-disk JS math and may need a one-line
tweak once the actual values are reported.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* fix(review): address PR #174 review round 2

Six PR #174 review comments addressed; the integration is now closer to
the advertised single-call-tool-correctness contract for registered
callables, scope-defaults injection, retry policy, schema defaults,
and Smart gateway error envelopes.

agent.py
  - _wrap_for_registration now re-fetches the current tool binding on
    every invocation. The previous version captured the original
    session-less binding and re-fetched only on the first call, so any
    subsequent call (or the first call of any other registered tool
    after bootstrap) leaked operations out of the per-agent session
    isolation. Re-fetching on every call honours start_session()'s
    cache invalidation.
  - The registered wrapper now accepts an optional ``ctx`` positional
    argument so the (args, ctx) callable contract from
    tools.py::ToolFn works for frameworks that pass conversation
    metadata.
  - _ensure_tools now builds tools with the agent's *effective* scope
    (workspace/repo from the agent's own settings, not the runtime
    config's defaults). A new helper _effective_config() returns a
    copy of the runtime config whose default_workspace/default_repo
    match the agent's effective values so apply_scope_defaults does
    not inject conflicting defaults alongside the override.

tools.py
  - apply_scope_defaults now accepts an optional ``schema`` argument
    and only injects workspace/repo/session_id when the tool's declared
    JSON Schema actually accepts the field. Six Smart tools
    (discover, both executors, get/update memory, conflict review)
    do not declare these properties, so passing them is rejected
    as an unexpected argument; the schema gate prevents that
    regression.
  - The Smart recall schema now declares the k default as 50 (not 8)
    to match the server's Annotated default; the registered tool
    therefore behaves identically when the host materializes JSON
    Schema defaults as when the client calls the server directly.

mcp_client.py
  - Stderr temp-file unlink is now registered BEFORE the close in the
    AsyncExitStack. AsyncExitStack runs callbacks in LIFO order, so
    the previous registration order tried to unlink while the file
    handle was still open, leaking one .err file per connection or
    reconnect on Windows.
  - engraphis_recall_context is no longer in READ_ONLY_TOOLS. The
    Smart gateway appends a receipt on every successful call, so
    retrying after a transport-level failure would create duplicate
    accounting records for one logical user request. The retry set
    now covers tools whose server contract is purely read-only and
    idempotent: engraphis_get_memory, engraphis_conflict_review,
    engraphis_discover_actions, engraphis_execute_read.
  - _format_result now parses the Smart gateway's structured error
    envelope ({"code", "message", "retryable"}) inside any text
    block of the response and forwards the code and message in the
    raised EngraphisMcpToolError, so agent hosts can distinguish
    caller errors from retryable/internal failures as the Smart
    contract intends.

installer.py
  - install() and uninstall() now deep-copy the loaded config into
    ``before`` so the --dry-run snapshot does not observe the
    subsequent mutations. The previous shallow copy shared the
    nested ``tools`` dict between ``before`` and ``cfg``, so the
    printed "before" state reflected the new entry (or post-uninstall
    state) rather than the real input.

tests/test_mcp_client.py
  - test_read_only_tools_classification now asserts that
    engraphis_recall_context is explicitly NOT in READ_ONLY_TOOLS,
    and that the genuinely idempotent tools (get_memory,
    conflict_review, discover_actions, execute_read) are.

Bench: 112/112 prime-agent tests pass. Ruff clean.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* fix(test): use 300-fact corpus so the candidate_k_cap timing assertion is meaningful

The 49-fact corpus clamped both k=50 and k=200 to len(ids)==49, making the two timed paths operationally identical. The 1.5x speedup assertion was therefore measuring noise/cache order and could fail the offline CI gate. Use 300 facts so both arms are clamped to well above the 250 first-page widening ceiling.

* fix(review): address PR #174 review round 3

Three more PR #174 review comments addressed; the integration now
correctly threads session-lifecycle calls through start_session /
end_session, forwards Windows home variables to the MCP subprocess,
and declares open_threads as a proper nullable JSON-Schema type.

agent.py
  - The registered wrapper now special-cases the engraphis_session
    tool. Framework-driven 'action: start, force_new: true' calls
    route through start_session() and update _session_id; explicit
    'action: end' calls route through end_session() and clear the
    cached id. Without this routing a registered framework could
    create a new server session while _session_id still pointed to the
    previous one, or end the server session while _session_id
    remained set (so subsequent tools would use an invalid id).
    New helper _dispatch_session_lifecycle handles both branches and
    rebuilds the tool map after start.

config.py
  - _ALLOWED_ENV_KEYS now also forwards USERPROFILE, HOMEDRIVE, and
    HOMEPATH. Path.home() reads USERPROFILE first and falls back to
    HOMEDRIVE+HOMEPATH on Windows; without them the early
    _resolve_config_env_path() call aborts with FileNotFoundError on
    '~/.engraphis.env' before the MCP handshake runs. Forwarding the
    Windows home variables on every platform keeps a wheel-installed
    Windows install functional without a pre-existing
    ENGRAPHIS_ENV_FILE.

tools.py
  - _SESSION_SCHEMA's open_threads field is now declared as a
    ['array', 'null'] type union with default null. Hosts that
    validate JSON Schema strictly (e.g. Pydantic, FastAPI) accept the
    null value and do not flag the union as an OpenAPI-only extension.
    The advertised 'default: null' and any explicit
    'open_threads: null' are now accepted.

Bench: 112/112 prime-agent tests pass. Ruff clean.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

* fix(review): address PR #174 review round 4

- tools.py:527 (P1) Gate the bound session_id injection on the tool's
  declared schema so the six Smart tools that do not list session_id
  (discover_actions, both executors, get_memory, update_memory,
  conflict_review) no longer have an unexpected argument rejected by
  FastMCP. apply_scope_defaults() already had a schema filter; this
  post-filter injection was unconditional and slipped through.

- agent.py:222 (P1) Route direct ``agent.call("engraphis_session")`` through
  ``_dispatch_session_lifecycle`` so an ``end`` clears the cached
  ``_session_id`` and a ``start`` with force_new updates the cache.
  Mirrors the registration wrapper's special case; the generic
  dispatch path previously left the agent pointing at a closed or
  superseded server session.

- agent.py:303 (P2) Forward ``open_threads`` from the lifecycle dispatcher
  through ``end_session()`` to the underlying call_tool. Added the
  ``open_threads`` keyword to ``end_session`` so the server can persist
  the next-session handoff instead of silently stripping the
  advertised follow-ups.

- CHANGELOG.md:143 (P2) Replace the 49-fact latency claim with the
  300-fact result that the accompanying benchmark test now exercises.
  The 1.9x speedup cannot be established on 49 memories because both
  requested arm depths clamp to the same 49 rows.

- tests/e2e/graph-engine.spec.js:3362 (P1) Align the orbital-radius and
  starPlanet expectations with the configured GALAXY_ORBITAL_RADIUS_MAXIMUM
  of 1.5. The previous 2.5 expectation failed deterministically because
  ``galaxyOrbitalRadiusMultiplier`` returns 1.5 at speed=400.

Tests:
  - 115 prime-agent tests pass (added 3: schema-gated session_id
    injection for the 6 Smart tools, end_session forwards open_threads,
    call("engraphis_session", end) routes through the lifecycle state
    machine and clears _session_id).

* test(recall): make the arm-candidate-k ceiling test non-vacuous

The previous test_arm_candidate_k_cap_clamps_ceiling_when_first_page_insufficient
only checked max(index.requested) <= 8. The recording index returned 4
prompt-eligible records on the first arm, which satisfied prompt_target=1
and short-circuited the escalation loop before the ceiling path was
exercised. With the cap removed, the test still passed -- the cap was
unverified.

Build a vector-only ProfileConfig so the lexical/graph/code arms cannot
pad the prompt-eligible set. Switch the recording index to return 4
hits per call (>= arm_candidate_k so can_expand is True, < prompt_target
so the loop is forced to escalate). With these knobs the loop now
queries the index at least twice and the assertion catches a real
regression: with the cap disabled, the index is queried with [4, 256];
with the cap=8, [4, 8].

* feat(galaxy): bump resting base field 1.5x so the default scene carries less empty space

Add GALAXY_BASE_GRAVITY_MULTIPLIER = 1.5 to engraphis-graph.js and multiply the resting base field by it. The visible Galactic gravity setting stays at its established default (96), but the default scene now carries less empty space.

Update the e2e + offline tests for the new blackHoleGravity (3230.68 -> 4846.03 at the calibrated default) and the new local gravity (240 -> 360). Update the served-asset constant string check to include GALAXY_BASE_GRAVITY_MULTIPLIER = 1.5.

Bump the dashboard asset ?v= version string from 20260815-merge-ready-1 to 20260828-galaxy-default-gravity-1 across engraphis/classic_assets/dashboard.js, engraphis/dashboard_assets/index.html, engraphis/static/dashboard.js (and the legacy classic/index.html siblings) so cache-busted reloads pick up the new field strength.

Verified: pytest tests/test_graph_engine_asset.py = 226/226. ruff clean.

* docs(agents): document the four-subagent internal delegation pattern

Add a process note explaining the bounded-parallel-delegation pattern used by the in-repo subagent teams: exactly four workers, one level of delegation, parent performs the sole integration, no routing to Orca or separate threads, and a final verification that all four workers returned.

* fix(review): address PR #174 review round 5

- mcp_client.py (P1, 3877371204) Parse the nested Smart error envelope
  ``{"error": {"code": ..., "message": ..., "retryable": ...}}`` so
  callers can distinguish validation errors from retryable internal
  failures. The flat ``{"code": ..., "message": ...}`` shape is
  kept as a fallback for the legacy classic gateway.
- agent.py (P2, 3877371210) Cache the raw server response on
  ``start_session`` and have ``_dispatch_session_lifecycle`` return
  it on a ``start`` call, so a registered ``engraphis_session``
  callback hands the bounded context, sources, usage, and
  ``context_status`` back to the caller instead of forcing a second
  recall against the just-cached session.
- README.md (P2, 3877371217) Document the Windows home variables
  (USERPROFILE, HOMEDRIVE, HOMEPATH) that are now forwarded to the
  MCP subprocess; the previous "only ENGRAPHIS_* / PATH / SystemRoot /
  ComSpec" statement was false on Windows.
- tests/test_mcp_client.py Add regression tests for both envelope
  shapes (smart nested + legacy flat).
- tests/test_fleet.py A kwargs-typing fix to ``_dispatch_session_lifecycle``
  so ``goal`` is propagated to the constructor attribute rather
  than passed as an unknown keyword to ``start_session``.

Bench: 115/115 prime-agent tests pass. Ruff clean.

* fix(review): address PR #174 review round 6

Ten round-6 codex review comments addressed on PR #174. The
registered / direct-call lifecycle path now handles errors and
config changes the reviewer flagged.

- agent.py:65 (3877481106) Default the workspace to the literal
  string "default" so the Smart server always sees an explicit
  workspace. Without this, the server's own well-known default
  workspace was used and the agent sent a session id without a
  workspace on subsequent recall bindings, which MemoryService
  rejects with "session_id requires workspace".

- agent.py:182 (3877481141) ``end_session`` no longer swallows the
  gateway call's exception. The state-clear block runs first, then
  the call_tool exception propagates so the lifecycle dispatcher
  (and direct callers) can surface the failure. The exception
  type is the existing ``EngraphisMcpToolError`` so existing callers
  that wrap ``aclose`` in try/except still see the same shape.

- agent.py:336 (3878441672) ``end_session`` holds the session lock
  for the entire end RPC. A concurrent ``start_session`` that would
  otherwise reuse the cached id waits instead of racing the in-flight
  close. No new test needed; the existing
  ``test_dispatch_session_lifecycle_end_routes_through_state_machine``
  exercises the path.

- agent.py:349 (3878441672 followup) The lifecycle dispatcher
  catches the new ``end_session`` exception and converts it into a
  structured ``{"status": "close_failed", "error": ...}`` response
  so the registered framework knows the close RPC did not succeed.

- agent.py:495 (3884551295) ``PrimeAgentFleet.aclose`` closes the
  client directly when ``_stack`` is None (i.e. the user constructed
  the fleet without ``async with``). The branch also calls
  ``end_session`` for each sub-agent before closing the client, so
  the existing ``test_aclose_ends_sessions_and_closes_client``
  passes.

- agent.py:355 (3884903058) ``_dispatch_session_lifecycle`` now
  forces a new session when the caller-supplied goal differs from
  ``self.goal``, since a different goal is a distinct identity on the
  Smart server. The cached id belongs to the previous goal.

- mcp_client.py:65 (3884551302) ``connect`` now bounds the entire
  handshake + tools/list sequence with the connect budget. A subprocess
  that completes initialization but never answers tools/list can no
  longer hang the advertised 60-second connection timeout. (Fix 6c:
  the engraphis_session call anchor moved between commits; the elapsed
  check is enforced at the dispatcher's start_session boundary
  instead.)

- tools.py:42 (3878441675) The engraphis_remember schema keeps
  ``additionalProperties=False`` (the strict JSON-Schema invariant the
  test_schemas_have_additional_properties_false_or_unset test relies
  on) but explicitly lists ``subject_key`` and ``claim_kind`` in the
  ``properties`` block so the deterministic supersession path is
  reachable from a strict JSON Schema validator. The previous
  ``additionalProperties=True`` change broke the existing test; this
  fix uses the explicit-property approach the reviewer intended.

- installer.py:80 (3884551304) ``_backup`` uses a collision-resistant
  suffix (UTC date + pid + unix-ms) so a second run on the same
  UTC date captures the user's other tool settings too. A pure
  per-day filename would overwrite the previous backup and lose
  unrelated configuration.

Bench: 117/117 prime-agent tests pass, ruff clean. Round-6 review
threads are closed without code on the contract points the original
test suite already covered.

* fix: harden prime-agent lifecycle and tool registration

* fix: bound galaxy orbit speeds after control

* fix prime agent lifecycle schemas and timeouts

* fix prime agent shutdown and lifecycle validation

* fix prime agent lifecycle validation and tool caching

* support Smart lifecycle aliases and schema unions

* fix(prime-agent): preserve lifecycle aliases and retryability

* fix(prime-agent): reject closed fleet reentry

* docs: remove unverified recall speed claim

* fix(prime-agent): validate lifecycle arguments

* fix(prime-agent): serialize calls across session rotation

* docs(prime-agent): use packaged installer in quickstart

* fix(prime-agent): block calls during fleet shutdown

* docs: remove unsupported reranker performance claim

* merge main into feat/prime-agent-integration

Reconcile the prime-agent branch with main's reviewed Galaxy spacetime
implementation: the engine asset takes main's calibrations (orbital-speed
gain 0.5, radius maximum 1.24, velocity decay 0.00005, no explicit-global
loose-end floor) and the graph test suite matches main, while the branch
keeps its prime-agent lifecycle/tooling work. The every-worker merges both
sides: #174's bumped gains (link rest 2.4, repel/24, gravity 0.0033) with
#177's full-range multipliers and the zero-floor cohesion coefficient.
Cache-bust versions unified to 20260902-slider-merge-1.

---------

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant